// Copyright (C) 2010  Joan Puigcerver Perez, <joapuipe@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

#ifndef __FILTER_HPP__
#define __FILTER_HPP__

#include <BasicTypes.hpp>

#include <Movie.hpp>
#include <Person.hpp>
#include <Link.hpp>
#include <Media.hpp>
#include <Genres.hpp>
#include <Work.hpp>

/**
 * \class Filter
 *
 * Class used to represent the set of filtering options in requests. The people, movies or links
 * that do not pass the filter, are not considered to build the response.
 *
 */
class Filter {
public:
  /* People filtering options */
  // None. e.g: Age.


  /* Movie filtering options */
  /** Movies released before this year are discarted. */
  Year min_year;
  /** Movies released after this year are discarted. */
  Year max_year;
  /** If false, suspended movies are discarted. */
  bool suspended;
  /** Set of valid movie medias. */
  Media media;
  /** Set of valid movie genres. */
  Genres genres;


  /* Link filtering options */
  /** Set of valid person works in a movie. */
  Work work;

  
  /**
   * Empty constructor. No filters are applied. 
   */
  Filter(); 

  /** 
   * Constructor that creates a Filter object with the
   * desired filtering options. 
   * @param min_year Movies released before this year are discarted.
   * @param max_year Movies released after this year are discarted.
   * @param suspended If false, suspended movies are discarted.
   * @param media Set of valid movie medias.
   * @param genres Set of valid movie genres.
   * @param work Set of valid person works in a movie.
   */
  Filter(Year min_year, Year max_year, bool suspended,
	 Media media, Genres genres, Work work);
  
  /** 
   * Method that decides if a Person passes the filter. 
   */
  bool pass(const Person * person) const;

  /** 
   * Method that decides if a Movie passes the filter. 
   */
  bool pass(const Movie * movie) const;

  /** 
   * Method that decides if a Link passes the filter.
   */
  bool pass(const Link * link) const;  
};

#endif
